﻿using Ozone.BLL;
using Ozone.Device;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Ozone.Views.SystemCenter.AdvancedParameter
{
    /// <summary>
    /// RobotAdvancedParameter.xaml 的交互逻辑   机械臂
    /// </summary>
    public partial class RobotAdvancedParameter : UserControl
    {

        public RobotAdvancedParameter()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 连接
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnConnect_click(object sender, RoutedEventArgs e)
        {
            string tag = ((Button)sender).Tag.ToString();
            //连接右机械臂
            if (tag == "RightRot")
            {
                //devRobot.InitRobot();
            }
            //连接左机械臂
            if (tag == "LeftRot")
            {
                //devRobot.InitRobot();
            }
            //连接天平
            if (tag == "Balance")
            {
                //devBalance.Init();
            }
            //连接蠕动泵
            if (tag == "PeristalticPump")
            {
                //devPeristalticPump.con;
            }


        }

        /// <summary>
        /// 微调机械臂
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnMove_click(object sender, RoutedEventArgs e)
        {
            //移动步长
            float offset = 0;
            //移动速度
            float Speed = 0;
            //Tag值
            string Tag = ((Button)sender).Tag.ToString();
            //选择机械臂
            string Robot = string.Empty;
            if (txt_Step.Text != "0")
            {
                offset = float.Parse(txt_Step.Text);
            }

            if (txt_Speed.Text != "0")
            {
                Speed = float.Parse(txt_Speed.Text);
            }
            else
            {
                MessageBox.Show("请选择步长和速度!");
                return;
            }
            if (RightRotCheck.IsChecked == true)
            {
                
            }
            //选择的是左机械臂
            if (leftRotCheck.IsChecked == true)
            {

                
            }
        }

        /// <summary>
        /// 获取当前点位信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnGetPos_click(object sender, RoutedEventArgs e)
        {
            //右机械臂
            if (RightRotCheck.IsChecked == true)
            {
               
            }
            //左机械臂
            if (leftRotCheck.IsChecked == true)
            {
               
            }
        }

        /// <summary>
        /// 夹爪开 （最大间距）
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnJawOpen_click(object sender, RoutedEventArgs e)
        {
         
        }

        /// <summary>
        /// 夹爪合（最小间距）注：夹取不带瓶盖的瓶子使用
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnJawClose_click(object sender, RoutedEventArgs e)
        {
         
        }

        /// <summary>
        /// 夹瓶子（带瓶盖的瓶子）
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnJawBottle_click(object sender, RoutedEventArgs e)
        {
          
        }

        /// <summary>
        /// 横抓开
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnHorizontalJawOpen_click(object sender, RoutedEventArgs e)
        {
           


        }

        /// <summary>
        /// 横抓关
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnHorizontalJawClose_click(object sender, RoutedEventArgs e)
        {
           
        }

        /// <summary>
        /// 执行配液瓶夹取 开盖 放到天平上动作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSolventBottle_click(object sender, RoutedEventArgs e)
        {
            int SolventBottleNumber = Convert.ToInt32(this.txt_SolventBottleNumber.Text);
            float Speed = 0;
            if (txt_Speed.Text != "0")
            {
                Speed = float.Parse(txt_Speed.Text);
            }
          
        }
        /// <summary>
        /// 原料瓶扫码开瓶盖
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnStockBottle_click(object sender, RoutedEventArgs e)
        {
            int txt_StockBottleNumber = Convert.ToInt32(txt_StockBottleHoming.Text);
            float Speed = 0;
            if (txt_Speed.Text != "0")
            {
                Speed = float.Parse(txt_Speed.Text);
            }

            if (txt_StockBottleNumber > 4)
            {
              

            }
            else
            {
               

            }
        }

        /// <summary>
        /// 配液瓶回原点
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSolventBottleHoming_click(object sender, RoutedEventArgs e)
        {
            int SolventBottleNumber = Convert.ToInt32(this.txt_SolventBottleNumber.Text);
            float Speed = 0;
            if (txt_Speed.Text != "0")
            {
                Speed = float.Parse(txt_Speed.Text);
            }


      

        }

        /// <summary>
        /// 原料瓶回原点
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnStockBottleHoming_click(object sender, RoutedEventArgs e)
        {
            int txt_StockBottleHoming = Convert.ToInt32(this.txt_StockBottleHoming.Text);
            float Speed = 0;
            if (txt_Speed.Text != "0")
            {
                Speed = float.Parse(txt_Speed.Text);
            }

            if (txt_StockBottleHoming > 4)
            {
            }
            else
            {
            }


        }
        /// <summary>
        /// 配液瓶放到放置位
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPlace_click(object sender, RoutedEventArgs e)
        {

        }
        /// <summary>
        /// 加原料
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddStockBottle_click(object sender, RoutedEventArgs e)
        {
            int txt_TakeTipNumber = Convert.ToInt32(this.txt_TakeTipNumber.Text);
            float Speed = 0;
            if (txt_Speed.Text != "0")
            {
                Speed = float.Parse(txt_Speed.Text);
            }



            if (txt_TakeTipNumber > 10)
            {

            }
            else
            {
            }
        }

        /// <summary>
        /// 稀释液
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddWater_click(object sender, RoutedEventArgs e)
        {
            float Speed = 0;
            if (txt_Speed.Text != "0")
            {
                Speed = float.Parse(txt_Speed.Text);
            }
        }


        /// <summary>
        /// 阻塞泵停止
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnjtingz_click(object sender, RoutedEventArgs e)
        {
        }

        /// <summary>
        /// 开始 主扫泵开始 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnjiayekishi_click(object sender, RoutedEventArgs e)
        {





        }






        /// <summary>
        /// 查询天平数值
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnGetBalanceValue_click(object sender, RoutedEventArgs e)
        {
            string Message = string.Empty;
        }

        /// <summary>
        /// 去皮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnRemoveThePeel_click(object sender, RoutedEventArgs e)
        {
        }

        /// <summary>
        /// 插管
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnStar_click(object sender, RoutedEventArgs e)
        {


        }

        /// <summary>
        /// 复位
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnStop_click(object sender, RoutedEventArgs e)
        {

        }

        /// <summary>
        /// Z轴回原点
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnCorotation_click(object sender, RoutedEventArgs e)
        {

        }

        /// <summary>
        /// 移动Z轴
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnReversal_click(object sender, RoutedEventArgs e)
        {
            // DeviceCenter.Entity.devXZAxleYKD2405PR.ZMov();
        }



        /// <summary>
        /// 加液体
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnjiaye_click(object sender, RoutedEventArgs e)
        {


            int A = Convert.ToInt32(txt_StockBottlesuduVince.Text);
        }

        /// <summary>
        /// 右机械臂复位
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnRightFW_click(object sender, RoutedEventArgs e)
        {
        }

        /// <summary>
        /// 左机械臂复位
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnLeftFW_click(object sender, RoutedEventArgs e)
        {
        }

        /// <summary>
        /// 移动
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnBeginPos_click(object sender, RoutedEventArgs e)
        {

        }

        private void btnStock_click(object sender, RoutedEventArgs e)
        {
            int txt_StockBottleNu1 = Convert.ToInt32(this.txt_StockBottleNu1.Text);


        }

        private void btnVinceStop_click(object sender, RoutedEventArgs e)
        {
        }

        /// <summary>
        /// 切换六通阀门
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSV06_click(object sender, RoutedEventArgs e)
        {

            string tag = ((Button)sender).Tag.ToString();

            if (tag == "1")
            {

            }
            else if (tag == "2")
            {

            }
            else if (tag == "3")
            {

            }
            else if (tag == "4")
            {

            }


        }


    }


}
